using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Linq.Expressions;

namespace Infrastructure.Interface
{
    /// <summary>
    /// 定义获取分页数据的接口
    /// <remarks></remarks>
    /// </summary>
    /// <typeparam name="T">实体类型</typeparam>
    public interface IPagable<T>
    {
        /// <summary>
        /// 分页的基础方法
        /// </summary>
        /// <typeparam name="TNew">投影的类型</typeparam>
        /// <param name="where">条件</param>
        /// <param name="selector">选择器</param>       
        /// <param name="orderByString">排序字符串</param>
        /// <param name="pageIndex">页面索引</param>
        /// <param name="pageSize">页面大小</param>
        /// <returns></returns>
        PageBase<TNew> ToPage<TNew>(Expression<Func<T, bool>> where, Expression<Func<T, TNew>> selector, string orderByString, int pageIndex, int pageSize) where TNew : class;


        /// <summary>
        /// 分页的基础方法
        /// 数据合为一页
        /// </summary>
        /// <param name="where">条件</param>
        /// <param name="selector">选择器</param>
        /// <param name="orderByString">排序字符串</param>
        /// <returns></returns>
        PageBase<TNew> ToPage<TNew>(Expression<Func<T, bool>> where, Expression<Func<T, TNew>> selector, string orderByString) where TNew : class;
    }
}
